package com.tuo51.childcare.repository;

import com.tuo51.childcare.domain.dailyrecord.DailyGrowRecordTemplate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DailyGrowRecordTemplateRepository extends JpaRepository<DailyGrowRecordTemplate,String>, JpaSpecificationExecutor<DailyGrowRecordTemplate> {

    @Query (value = "select * from user_daily_observer_template t " +
            "where t.deleted = false and t.monthMin < ?1 and t.monthMax > ?1 " +
            "order by t.dailyIndex", nativeQuery = true)
    List<DailyGrowRecordTemplate> findDailyTemplates(Integer month);
}
